<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用math寻找最大值和最小值</title>
</head>
<body>
    <script>
        var gu=[];
        for(var i=0;i<10;i++){
            gu.push(parseInt(Math.random()*100+1));
        }
        gu.sort(function(a,b){
            return b-a;
        })
        document.write(gu+'最大值为'+Math.max.apply(null,gu)+'最小值'+Math.min.apply(null,gu));
        
    </script>
</body>
</html>